﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using static WenSkin.Controls.WenDataTextBox;

namespace WenSkin.Design.Designer
{
    public class WenDataTextBoxDesigner : TextDesigner
    {
        public override void AddDesignerActionList()
        {
            this.ActionLists.Add(new WenDesignerActionList(this.Component));
        }

        public class WenDesignerActionList : TextBoxDesignerActionList
        {
            public WenDesignerActionList(IComponent component) : base(component)
            {
            }

            [Editor(typeof(Design.Editor.WenCollectionEditor), typeof(UITypeEditor))]
            public WenDataTextBoxColumnTextCollection Items
            {
                get => TypeDescriptor.GetProperties(this.Component)["Items"].GetValue(this.Component) as WenDataTextBoxColumnTextCollection;
                set => TypeDescriptor.GetProperties(this.Component)["Items"].SetValue(this.Component, value);
            }
            public override DesignerActionItemCollection GetSortedActionItems()
            {
                DesignerActionPropertyItem text = new DesignerActionPropertyItem("Text", "文本");
                DesignerActionPropertyItem item = new DesignerActionPropertyItem("Items", "集合编辑");

                return new DesignerActionItemCollection() { text, item };
            }
        }
    }
}
